﻿// Inner Fire 游戏引擎库
// DxInput DirectX输入管理器
//
// Copyright (c) 2025 by 尔西大帝. All rights reserved.
//
// 所属层级：元素层(3)
// 用于管理DirectInput
//
// Author: 尔西大帝
// Email: 2670613871@qq.com
// Created: 2025-04-26

#pragma once

#include <dinput.h>
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")

namespace ifire::dx {
class DxInput {
public:
  DxInput();
  DxInput(const DxInput& lhs) = delete;
  DxInput& operator=(const DxInput& lhs) = delete;
  ~DxInput();

public:
  bool Initialize(HINSTANCE hInstance, HWND hWnd);

  void FixedUpdate();

  // 获取鼠标移动增量
  void GetMouseMovement(int& deltaX, int& deltaY, int& deltaZ) const;

  // 检查鼠标按键状态（0=左键,1=右键,...）
  bool IsMouseButtonDown(int button) const;  

private:
  LPDIRECTINPUT8 pDI = nullptr;
  LPDIRECTINPUTDEVICE8 pMouse = nullptr;
  DIMOUSESTATE mouseState = {};
};
} // namespace ifire::dx
